package com.kangye.exam.exceptin;


import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.client.HttpClientErrorException;

/*
 * 全局异常处理
 * */
@ControllerAdvice
public class GlobalException {


    @ExceptionHandler(value = {NullPointerException.class})
    @ResponseBody
    public Object null_point_exception(Exception e) {
        e.printStackTrace();
        return "{'code':-5},{'msg':'空指针'}";
    }
}